import Vue from 'vue';
import Router from 'vue-router';
import { findTreeItem } from '../lib/util';

const Login = () => import('../views/common/Login.vue');
const Home = () => import('../views/common/Home.vue');
// 订单模块
const OrderBrowse = () => import('../views/order/OrderBrowse.vue');
const TruckLoadMessage = () => import('../views/truck_load_order/TruckLoadMessage.vue');
const TruckLoadOrder = () => import('../views/truck_load_order/TruckLoadOrder.vue');
// const TruckLoadEarnest = () => import('../views/truck_load_order/TruckLoadEarnest.vue');
// const TruckLoadDistinguishService = () => import('../views/truck_load_order/TruckLoadDistinguishService.vue');
const OrderImport = () => import('../views/order/OrderImport.vue');
const OrderEntering = () => import('../views/order/OrderEntering.vue');
const OrderManage = () => import('../views/order/OrderManage.vue');
const OrderNew = () => import('../views/order/order-entering/OrderNew.vue');
const OrderEnteringUser = () => import('../views/order/OrderEnteringUser.vue');
const OrderManageUser = () => import('../views/order/OrderManageUser.vue');
const OrderPayBackPage = () => import('../views/order/OrderPayBackPage.vue');
const OrderTrack = () => import('../views/order/OrderTrack.vue');
const TruckLoadDriver = () => import('../views/truck_load_order/TruckLoadDriver.vue');
const OrderPriceAffirm = () => import('../views/order/OrderPriceAffirm.vue');

const TransitEpiboly = () => import('../views/transit/TransitEpiboly.vue');
const SelfExtract = () => import('../views/transit/SelfExtract.vue');
const OrderModify = () => import('../views/order/OrderModify.vue');
const ReceptionEntering = () => import('../views/order/ReceptionEntering.vue');
const OrderReceptionRecord = () => import('../views/order/OrderReceptionRecord.vue');
const OrderDistinguishConfig = () => import('../views/order/OrderDistinguishConfig.vue');
const CustomerServiceStatics = () => import('../views/order/CustomerServiceStatistics.vue');
const OrderInfoFeeDetail = () => import('../views/order/OrderInfoFeeDetail.vue');

const demoSelect = () => import('../views/demo/demoSelect.vue');
const DateDiscount = () => import('../views/demo/DateDiscount.vue');
const exportDemo = () => import('../views/demo/exportDemo.vue');
const View = () => import('../views/common/View.vue');
const BigForm = () => import('../views/demo/BigForm.vue');
const Table = () => import('../views/demo/Table.vue');
const LoadItem = () => import('../views/common/Load.vue');
const Coupon = () => import('../views/marketing/coupon.vue');
const PersonalGroup = () => import('../views/message/PersonalGroup.vue');
const SendMessage = () => import('../views/message/SendMessage.vue');
const MessageRecord = () => import('../views/message/MessageRecord.vue');
// 营销中心--轮播图
const advertisementPicture = () => import('../views/marketing/advertisementPicture.vue');
const ItemName = () => import('../views/system/itemName.vue');
const Version = () => import('../views/system/Version.vue');
// 顾客类
const Maintain = () => import('../views/customer/maintain.vue');
const TicklingManage = () => import('../views/customer/TicklingManage.vue');
const RechargeBackPage = () => import('../views/customer/rechargeBackPage.vue');
const PersonalDetails = () => import('../views/meb-user/PersonalDetails.vue');
const CapitalAccount = () => import('../views/meb-user/CapitalAccount.vue');
const AddressManage = () => import('../views/meb-user/AddressManage.vue');
const TaxsheetTitle = () => import('../views/meb-user/TaxsheetTitle.vue');
const Taxsheet = () => import('../views/meb-user/TaxSheet.vue');
// 新闻公告类
const pressReleaseDetail = () => import('../views/marketing/pressReleaseDetail.vue');
const platFormPressRelease = () => import('../views/marketing/platFormPressRelease.vue');
const pressRelease = () => import('../views/marketing/pressRelease.vue');
const CustomerManage = () => import('../views/customer/CustomerManage.vue');

const AddressSelect = () => import('../views/demo/addressSelect.vue');
const AddressSelectValid = () => import('../views/demo/addressSelectValid.vue');
const checkboxEx = () => import('../views/demo/checkboxEx.vue');
const formHandle = () => import('../views/demo/FormHandle.vue');

// 运价文件
const Freight = () => import('../views/freight/freight.vue');
// const freightAdd = () => import('./views/freight/freightAdd.vue');
const freightDetail = () => import('../views/freight/freightDetail.vue');
const FreightContract = () => import('../views/freight/FreightContract.vue');
const FreightContractDetail = () => import('../views/freight/freightContractDetail.vue');

const markCargo = () => import('../views/system/MarkCargo.vue');
// 运价管理-增值服务
const freightAddValue = () => import('../views/freight/addValue.vue');

// 运价管理-预约优惠
const RuleFreight = () => import('../views/freight/RuleFreight.vue');
// 运价管理-短途运价
const freightShort = () => import('../views/freight/freightShort.vue');
// 运价管理-优惠线路
const lineRuleFreight = () => import('../views/freight/lineRuleFreight.vue');
// 运价管理-优惠线路NEW（按线路）
const freightAppoint = () => import('../views/freight/freightAppoint.vue');
// 系统-专线服务
const specialLine = () => import('../views/system/SpecialLine.vue');
const ShortBarge = () => import('../views/stowage/ShortBarge.vue');
const ShortTask = () => import('../views/stowage/ShortTask.vue');
// 运营管理-自送网点入库管理
const CustomerDelivery = () => import('../views/stowage/CustomerDelivery.vue');
// 运营管理-到达接车管理
const ArrivalReceive = () => import('../views/stowage/ArrivalReceive.vue');
// 运营管理-签收
const SingOff = () => import('../views/stowage/SignOff.vue');
// 运营管理--专线回单
const SpceialReceipt = () => import('../views/stowage/SpecialReceipt.vue');
// 运营管理-专线追踪
const SpecialDelivery = () => import('../views/stowage/SpecialDelivery.vue');
// 运营管理-司机管理
const driverManage = () => import('../views/stowage/DriverManage.vue');
// 运营管理-精品线路管理
const ExcellentRoute = () => import('../views/stowage/excellent-route/ExcellentRoute.vue');
// 运营管理-服务承诺列表
const ExcellentRouteServiceList = () => import('../views/stowage/excellent-route/ExcellentRouteServiceList.vue');
// 运营管理-价格保护申请
// const ExcellentRouteCompensationPrice = () => import('../views/stowage/excellent-route/ExcellentRouteCompensationPrice.vue');
// 运营管理-时效补偿申请
const ExcellentRouteCompensationTime = () => import('../views/stowage/excellent-route/ExcellentRouteCompensationTime.vue');
// 运营管理-先行理赔申请
const ExcellentRouteCompensationInstance = () => import('../views/stowage/excellent-route/ExcellentRouteCompensationInstance.vue');
// 运营管理-车辆管理
const VehicleManage = () => import('../views/stowage/VehicleManage.vue');
// 运营管理-车辆跟踪
const VehicleLocation = () => import('../views/stowage/VehicleLocation.vue');

const SpecialTrace = () => import('../views/stowage/SpecialTrace.vue');
const LoadingList = () => import('../views/stowage/LoadingList.vue');

// 合伙人管理
const PartnerManage = () => import('../views/partner/PartnerManage.vue');
// 结算管理
const OrderReceivable = () => import('../views/settlement_platform/OrderReceivable.vue');
const Invoice = () => import('../views/settlement_platform/Invoice.vue');
const MaxsheetManage = () => import('../views/settlement_platform/TaxsheetManage.vue');
const OrderReceivableStatistics = () => import('../views/settlement_platform/OrderReceivableStatistics.vue');
const RenderAccount = () => import('../views/settlement_platform/RenderAccount.vue');
const SpecialIncome = () => import('../views/settlement_platform/SpecialIncome.vue');
const SpecialIncomeDetail = () => import('../views/settlement_platform/SpecialIncomeDetail.vue');
const TruckBellwetherIncome = () => import('../views/truck_load_order/truck_load_profit_summary/TruckBellwetherIncome.vue');
const TruckBellwetherIncomeDetail = () => import('../views/truck_load_order/truck_load_profit_summary/TruckBellwetherIncomeDetail.vue');
const PartnerProfitSummary = () => import('../views/settlement_platform/partner_profit_summary/PartnerProfitSummary.vue');
const PartnerProfitSummaryDetail = () => import('../views/settlement_platform/partner_profit_summary/PartnerProfitSummaryDetail.vue');
const OrganizationProfitSummary = () => import('../views/settlement_platform/organization_profit_summary/OrganizationProfitSummary.vue');
const OrganizationProfitSummaryDetail = () => import('../views/settlement_platform/organization_profit_summary/OrganizationProfitSummaryDetail.vue');
const OrganizationProfit = () => import('../views/settlement_platform/organization_profit_summary/OrganizationProfit.vue');
const HeadquartersProfitSummary = () => import('../views/settlement_platform/HeadquartersProfitSummary.vue');
const TruckloadProfitSummary = () => import('../views/truck_load_order/truck_load_profit_summary/TruckloadProfitSummary.vue');
// 系统总揽
const Dashboard = () => import('../views/dashboard/dashboard.vue');
const ShortTaskDriver = () => import('../views/statistics/ShortTaskDriver.vue');
const SpecialLine = () => import('../views/statistics/SpecialLine.vue');
const Partner = () => import('../views/statistics/partner.vue');

const Resource = () => import('../views/system/resource.vue');
const Role = () => import('../views/system/role.vue');
const User = () => import('../views/system/user.vue');
const Organization = () => import('../views/system/organization/organization.vue');
const DataPermission = () => import('../views/system/data-permission.vue');
const AddressDict = () => import('../views/system/AddressDict.vue');
const AddressConfig = () => import('../views/system/AddressConfig.vue');
// 系统配置-配载节点
const StowageCore = () => import('../views/system/stowageCore.vue');
// 系统配置-数字字典
const StmDict = () => import('../views/system/stmDict.vue');
const PayWayConfig = () => import('../views/system/pay-way-config/PayWayConfig.vue');
// 系统配置-系统配置
const StmParam = () => import('../views/system/stmParam.vue');
// 运力管理--承运商管理
const ServiceProvider = () => import('../views/cap/ServiceProvider.vue');
// 基础数据--领头羊管理
const TruckBellwether = () => import('../views/truck_load_order/truck-bellwether/TruckBellwether.vue');
// 基础数据--领头羊路线管理
const TruckBellwetherLinesManage = () => import('../views/truck_load_order/truck-bellwether/TruckBellwetherLinesManage.vue');
// 基础数据--领头羊辐射范围管理
const TruckBellwetherScopeManage = () => import('../views/truck_load_order/truck-bellwether/TruckBellwetherScopeManage.vue');
// 基础数据-领头羊账户管理页面
const TruckBellwetherAccountManage = () => import('../views/truck_load_order/truck-bellwether/TruckBellwetherAccountManage.vue');

// 系统配置-短信模板
const SmsTemplet = () => import('../views/system/smsTemplet.vue');
// 系统配置-群发短信
const SendSms = () => import('../views/system/sendSms.vue');
/**
 * 系统模块
 */
// 设置合伙人分成
const PartnerDivideConfig = () => import('../views/partner/PartnerDivideConfig.vue');
// 重抛比配置
const StmHeavyRatio = () => import('../views/system/StmHeavyRatio.vue');
// 订单告警
const StmAgeingWarning = () => import('../views/system/StmAgeingWarning.vue');
// 订单评价
const OrderEvaluation = () => import('../views/order/OrderEvaluation.vue');
// 订单评价
const OrderEvaluationManage = () => import('../views/order/OrderEvaluationManage.vue');
// 基础数据模块
const NetworkManagement = () => import('../views/basedata/NetworkManagement.vue');

const StandardPrice = () => import('../views/freight/standard-price/StandardPrice.vue');

const ChargingRule = () => import('../views/freight/charging-rule/ChargingRule.vue');
/**
 * 资金模块
 */
// 信息服务费
const InfoFeeCount = () => import('../views/settlement_platform/InfoFeeCount.vue');

// 信息服务费
const FundMebInfoFeeSet = () => import('../views/fund/FundMebInfoFeeSet.vue');

const InsuranceStatistics = () => import('../views/dashboard/InsuranceStatistics.vue');
const InsuranceRecord = () => import('../views/order/InsuranceRecord.vue');

const SpecialBoard = () => import('../views/stowage/SpecialBoard.vue');

const MessageTemplate = () => import('../views/message/MessageTemplate.vue');

Vue.use(Router);

const router = new Router({
  routes: [
    {
      path: '/login',
      component: Login,
      name: '',
      hidden: true
    },
    {
      path: '/full_screen',
      component: Dashboard
    },
    {
      path: '/',
      component: Home,
      name: '首页',
      iconCls: 'el-icon-message', // 图标样式class
      redirect: function () {
        let path = '';
        let user = JSON.parse(sessionStorage.getItem('user'));
        if (user == null || user === '' || user === undefined) {
          return path;
        }

        if (user.userType === 109006002) {
          return '/meb_user/order/manage';
        } else {
          const path = '/dashboard/dashboard';
          if (findTreeItem(user.nodes, 'path', path)) {
            return path;
          } else {
            return 'view';
          }
        }
      },
      children: [
        {
          path: 'dashboard',
          name: '系统总揽',
          component: View,
          children: [
            {
              path: 'dashboard',
              component: Dashboard,
              name: '总揽'
            },
            {
              path: 'shortTaskDriver',
              component: ShortTaskDriver,
              name: '短驳司机统计'
            },
            {
              path: 'specialLine',
              component: SpecialLine,
              name: '专线统计'
            },
            {
              path: 'partner',
              component: Partner,
              name: '事业合伙人'
            },
            {
              path: 'insurance_statistics',
              component: InsuranceStatistics,
              name: '零担投保数据统计'
            }
          ]
        },
        {
          path: 'view',
          component: View
        },
        {
          path: 'partners',
          name: '合伙人管理',
          component: View,
          children: [
            {path: 'partner-manage', component: PartnerManage, name: '合伙人列表'},
            {
              path: 'partnerDivideConfig',
              component: PartnerDivideConfig,
              name: '设置合伙人分成'
            }
          ]
        },
        {
          path: 'cap',
          name: '运力管理',
          component: View,
          children: [
            {
              path: 'service_provider',
              component: ServiceProvider,
              name: '承运商管理'
            }
          ]
        },
        {
          path: 'marketing',
          name: '营销中心',
          component: View,
          children: [
            {
              path: 'advertisement_picture',
              component: advertisementPicture,
              name: '轮播图'
            },
            {
              path: 'platFormPressRelease',
              component: platFormPressRelease,
              name: '新闻公告'
            },
            {
              path: 'pressReleaseDetail/:id',
              name: '新闻公告',
              component: pressReleaseDetail
            },
            {
              path: 'coupon',
              component: Coupon,
              name: '优惠券'
            },
            {
              path: 'pressRelease',
              component: pressRelease,
              name: '新闻公告管理'
            }
          ]
        },
        {
          path: 'freight_manage',
          name: '运价管理',
          component: View,
          children: [
            {
              path: 'line_rule_freight',
              component: lineRuleFreight,
              name: '优惠线路 '
            },

            {
              path: 'freight-short',
              component: freightShort,
              name: '短途运价 '
            },

            {
              path: 'rule-freight',
              component: RuleFreight,
              name: '提前预定优惠 '
            },

            {
              path: 'freight-add-value',
              component: freightAddValue,
              name: '增值服务 '
            },
            {
              path: 'freight',
              component: Freight,
              name: '运价文件'
            },
            {
              path: 'freight',
              component: Freight,
              name: '运价文件'
            },
            {
              path: 'freightDetail/:id',
              name: '基础运价',
              component: freightDetail
            },
            {
              path: 'freight/contract',
              component: FreightContract,
              name: '运价合同'
            },
            {
              path: 'freightContractDetail/:id',
              name: '协议保价',
              component: FreightContractDetail
            },
            {
              path: 'standard-price',
              name: '标准价格',
              component: StandardPrice
            },
            {
              path: 'charging-rule',
              name: '计费规则',
              component: ChargingRule
            },
            {
              path: 'freightAppoint',
              name: '计费规则',
              component: freightAppoint
            }
          ]
        },
        {
          path: 'customer',
          name: '客户管理',
          component: View,
          children: [
            {
              path: 'maintain',
              component: Maintain,
              name: '客户管理'
            },
            {
              path: 'TicklingManage',
              component: TicklingManage,
              name: '投诉建议'
            },
            {
              path: 'CustomerManage/:userId',
              component: CustomerManage,
              name: '账户信息',
              // 返回跳转
              meta: {parent: '/customer'}
            },
            {
              path: 'recharge/back',
              name: '充值回调',
              component: RechargeBackPage
            }
          ]
        },
        {
          path: 'system',
          name: '系统配置',
          component: View,
          children: [
            {
              path: 'AddressConfig',
              component: AddressConfig,
              name: '地址配置'
            },
            {
              path: 'pay_way_config',
              component: PayWayConfig,
              name: '付款方式配置'
            },
            {
              path: 'stm_param',
              component: StmParam,
              name: '系统配置'
            },
            {
              path: 'new_stm_dict',
              component: StmDict,
              name: '数字字典'
            },
            {
              path: 'stowage-core',
              component: StowageCore,
              name: '配载节点'
            },
            {
              path: 'itemName',
              component: ItemName,
              name: '热门货物品名'
            },
            {
              path: 'specialLine',
              component: specialLine,
              name: '专线服务'
            },
            {
              path: 'markCargo',
              component: markCargo,
              name: '短驳服务'
            },
            {
              path: 'version',
              component: Version,
              name: 'APP版本管理'
            },
            {
              path: 'version',
              component: Version,
              name: 'APP版本管理'
            }, {
              path: 'resource',
              component: Resource,
              name: '资源管理'
            }, {
              path: 'role',
              component: Role,
              name: '角色管理'
            }, {
              path: 'user',
              component: User,
              name: '用户管理'
            }, {
              path: 'organization',
              component: Organization,
              name: '组织管理'
            }, {
              path: 'data-permission',
              component: DataPermission,
              name: '数据权限组管理'
            }, {
              path: 'addressDict',
              component: AddressDict,
              name: '地址字典'
            }, {
              path: 'stmHeavyRatio',
              component: StmHeavyRatio,
              name: '重抛比配置'
            }, {
              path: 'sendSms',
              component: SendSms,
              name: '群发短信'
            }, {
              path: 'smsTemplet',
              component: SmsTemplet,
              name: '短信模板'
            },
            {
              path: 'stmAgeingWarning',
              component: StmAgeingWarning,
              name: '订单告警设置'
            },
            {path: 'truck-bellwether', component: TruckBellwether, name: '领头羊管理'},
            {path: 'truck-bellwether-lines-manage', component: TruckBellwetherLinesManage, name: '领头羊线路管理'},
            {path: 'truck-bellwether-scope-manage', component: TruckBellwetherScopeManage, name: '领头羊辐射范围管理'},
            {path: 'truck-bellwether-account-manage/:id', component: TruckBellwetherAccountManage, name: '领头羊管理 > 账户设置'}
          ]
        },
        {
          path: 'demo',
          name: 'demo',
          component: View,
          children: [
            {
              path: 'bigForm',
              component: BigForm,
              name: '大表单'
            },
            {
              path: 'formHandle',
              component: formHandle,
              name: '表单处理'
            },
            {
              path: 'table',
              component: Table,
              name: '表格'
            },
            {
              path: 'address_select',
              component: AddressSelect,
              name: '地址'
            }, {
              path: 'address_select_valid',
              component: AddressSelectValid,
              name: '地址验证'
            },
            {
              path: 'checkbox-ex',
              component: checkboxEx,
              name: 'Checkbox自定义值'
            },
            {
              path: 'demo-select',
              component: demoSelect,
              name: '下拉字典demo'
            },
            {
              path: 'date-discount',
              component: DateDiscount,
              name: '日期折扣'
            },
            {
              path: 'export-demo',
              component: exportDemo,
              name: '导出demo'
            }
          ]
        },
        {
          path: 'order',
          name: '订单管理',
          component: View,
          redirect: 'order/table',
          children: [
            {path: 'browse', component: OrderBrowse, name: '订单总览'},
            {path: 'manage', component: OrderManage, name: '订单管理'},
            {path: 'order-new', component: OrderNew, name: '订单管理-NEW'},
            {path: 'order_evaluation_manage', component: OrderEvaluationManage, name: '订单评价管理'},
            {path: 'entering', component: OrderEntering, name: '订单录入'},
            {path: 'import', component: OrderImport, name: '订单录入'},
            {path: 'track', component: OrderTrack, name: '订单跟踪'},
            {path: 'order_price_affirm', component: OrderPriceAffirm, name: '定价订单价格确认'},
            {path: 'orderReceptionRecord', component: OrderReceptionRecord, name: '修改记录'},
            {path: 'orderModify/:id', component: OrderModify, name: '订单修改'},
            {path: 'receptionEntering/:id', component: ReceptionEntering, name: '接待录入'},
            {path: 'customer_service_statics', component: CustomerServiceStatics, name: '客服统计'},
            {path: 'orderDistinguishConfig', component: OrderDistinguishConfig, name: '分单配置'},
            {path: 'insurance_record', component: InsuranceRecord, name: '零担投保记录'}
          ]
        },
        {
          path: 'truck_load',
          name: '整车管理',
          component: View,
          redirect: 'truck_load/table',
          children: [
            {path: 'truckLoadMessage', component: TruckLoadMessage, name: '整车信息'},
            {path: 'truckLoadOrder', component: TruckLoadOrder, name: '整车订单'},
            {path: 'truckLoadDriverManage', component: TruckLoadDriver, name: '整车司机'}
            // {path: 'truckLoadEarnest', component: TruckLoadEarnest, name: '整车销账管理'},
            // {path: 'truckLoadDistinguishService', component: TruckLoadDistinguishService, name: '整车分单地址'}
          ]
        },
        {
          path: 'message',
          name: '消息中心',
          component: View,
          children: [
            {path: 'message-template', component: MessageTemplate, name: '消息模板'},
            {
              path: 'personalGroup',
              component: PersonalGroup,
              name: '用户分群'
            },
            {
              path: 'SendMessage',
              component: SendMessage,
              name: '发送消息'
            },
            {
              path: 'MessageRecord',
              component: MessageRecord,
              name: '消息记录'
            }
          ]
        },
        {
          path: 'transit',
          name: '中转管理',
          component: View,
          children: [
            {path: 'epiboly', component: TransitEpiboly, name: '中转管理'},
            {path: 'selfextract', component: SelfExtract, name: '到达自提'}
          ]
        },
        {
          path: 'stowage',
          component: View,
          name: '运营管理',
          children: [
            {path: 'customer-delivery', component: CustomerDelivery, name: '自送网点入库管理'},
            {path: 'arrival-receive', component: ArrivalReceive, name: '到达接车管理'},
            {path: 'short-task', component: ShortTask, name: '接货入库管理'},
            {path: 'short-barge', component: ShortBarge, name: '短驳调度管理'},
            {path: 'sign-off', component: SingOff, name: '客户签收'},
            {path: 'special_trace', component: SpecialTrace, name: '专线追踪'},
            {path: 'driver-manage', component: driverManage, name: '司机管理'},
            {path: 'excellent-route', component: ExcellentRoute, name: '精品线路管理'},
            {path: 'excellent-route-service-list', component: ExcellentRouteServiceList, name: '精品线路服务承诺'},
            // {path: 'excellent-route-compensation-price', component: ExcellentRouteCompensationPrice, name: '价格保护申请'},
            {path: 'excellent-route-compensation-time', component: ExcellentRouteCompensationTime, name: '时效补偿申请'},
            {
              path: 'excellent-route-compensation-instance',
              component: ExcellentRouteCompensationInstance,
              name: '先行理赔申请'
            },
            {path: 'vehicle-manage', component: VehicleManage, name: '车辆管理'},
            {path: 'vehicle-location', component: VehicleLocation, name: '车辆跟踪'},
            {path: 'special_receipt', component: SpceialReceipt, name: '专线回单'}
          ]
        },
        {
          path: 'basedata',
          component: View,
          name: '基础数据',
          children: [
            {path: 'networkManagement', component: NetworkManagement, name: '网点管理'}
          ]
        }, {
          path: 'line-management',
          component: View,
          name: '专线管理',
          children: [
            {path: 'special-delivery', component: SpecialDelivery, name: '专线发货管理'},
            {path: 'loading-list', component: LoadingList, name: '装车列表'},
            {path: 'special-board', component: SpecialBoard, name: '专线看板'}
          ]
        },
        {
          path: 'settlement_platform',
          component: View,
          name: '结算平台',
          children: [
            {path: 'receivable', component: OrderReceivable, name: '订单应收管理'},
            {path: 'invoice', component: Invoice, name: '对账单管理'},
            {path: 'taxsheet_manage', component: MaxsheetManage, name: '发票管理'},
            {path: 'order_receivable_tatistics', component: OrderReceivableStatistics, name: '应收统计'},
            {path: 'render_account', component: RenderAccount, name: '到达报账管理'},
            {path: 'infoFeeCount', component: InfoFeeCount, name: '信息服务费'},
            {path: 'orderInfoFeeDetail/:id', component: OrderInfoFeeDetail, name: '信息服务费-订单'},
            {path: 'fundMebInfoFeeSet', component: FundMebInfoFeeSet, name: '信息费设置'},
            {path: 'specialIncome', component: SpecialIncome, name: '专线收益统计'},
            {path: 'special_income_detail', component: SpecialIncomeDetail, name: '专线收益明细'},
            {path: 'specialIncomeDetail/:id', component: SpecialIncomeDetail, name: '专线收益统计 > 收益明细'},
            {path: 'partner_profit_summary', component: PartnerProfitSummary, name: '合伙人收益统计'},
            {
              path: 'partner_profit_summary_detail/:partnerId',
              component: PartnerProfitSummaryDetail,
              name: '合伙人收益统计 > 合伙人收益明细'
            },
            {path: 'organization_profit_summary', component: OrganizationProfitSummary, name: '网点收益统计'},
            {
              path: 'organization_profit_summary_detail/:organizationId/:countyId',
              component: OrganizationProfitSummaryDetail,
              name: '网点收益统计 > 网点收益明细'
            },
            {path: 'organization_profit', component: OrganizationProfit, name: '网点收益统计'},
            {path: 'headquarters_profit_summary', component: HeadquartersProfitSummary, name: '总部收益统计'},
            {path: 'truck_bellwether_income', component: TruckBellwetherIncome, name: '领头羊收益统计'},
            {
              path: 'truck_bellwether_income_detail/:id',
              component: TruckBellwetherIncomeDetail,
              name: '领头羊收益统计 > 收益明细'
            },
            {path: 'truckload_profit_summary', component: TruckloadProfitSummary, name: '总部整车收益统计'}
          ]
        },
        {
          path: 'meb_user',
          component: View,
          name: '个人中心',
          children: [
            {path: 'personal-details', component: PersonalDetails, name: '个人信息'},
            {path: 'taxsheet', component: Taxsheet, name: '我的发票'},
            {path: 'taxsheet_title', component: TaxsheetTitle, name: '发票抬头管理'},
            {path: 'capital-account', component: CapitalAccount, name: '资金账户'},
            {path: 'address-manage', component: AddressManage, name: '地址管理'},
            {path: 'order_evaluation', component: OrderEvaluation, name: '订单评价'}
          ]
        },
        /**
         * 货主订单中心
         */
        {
          path: 'meb_user/order',
          component: View,
          name: '订单管理',
          children: [
            {path: 'manage', component: OrderManageUser, name: '订单管理'},
            {path: 'entering', component: OrderEnteringUser, name: '订单录入'},
            {path: 'pay/back', component: OrderPayBackPage, name: '支付回调'}
          ]
        },

        {
          path: 'load',
          component: LoadItem,
          name: '加载菜单'
        }
      ]
    }
  ]
});
router.beforeEach((to, from, next) => {
  // 清除总揽定时器
  if (window.dashboartInterval) {
    window.clearInterval(window.dashboartInterval);
  }
  if (window.driverInterval) {
    window.clearInterval(window.driverInterval);
  }
  if (to.path !== '/order/browse') {
    clearInterval(sessionStorage.getItem('orderTiming'));
  }
  if (to.path === '/login') {
    sessionStorage.removeItem('user');
    if (window.stomp) {
      window.stomp.disconnect();
    }
  }
  let user = JSON.parse(sessionStorage.getItem('user'));
  if (!user && to.path !== '/login') {
    next({path: '/login'});
  } else {
    next();
  }
});
export default router;
